package com.report.controller;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.entity.Collector;
import com.entity.Recharge;
import com.file.entity.FileCollector;
import com.recharge.entity.JsonRecharge;
import com.report.service.RechargeReportService;
import com.utils.JsonResult;

/**
 * @Title: RechargePrportController.java
 * @Package com.report.controller
 * @author 孙梦楠
 * @date 2017年9月18日 下午4:58:00
 * @version V1.0.0
 */
@RestController
@RequestMapping(value = "/report")
public class RechargeReportController {
	
	
	private static final Logger log = LoggerFactory.getLogger(RechargeReportController.class);


	@Autowired
	private RechargeReportService rechargereportservice;

	// 操作员充值报表
	@RequestMapping(value = "/recharge_ope", method = RequestMethod.POST)
	public JsonResult<List<JsonRecharge>> rechargereport(@RequestBody Recharge recharge,
			@CookieValue(value = "opecodecookie", required = false) String opecodecookie,
			@CookieValue(value = "languagecookie", required = false) String languagecookie)  {
		log.info("----");

		String issuetime1 = recharge.getIssuetime();
		String issuetime2 = recharge.getRechargetime();
		JsonResult<List<JsonRecharge>> list= rechargereportservice.rechargereport(issuetime1, issuetime2, opecodecookie, languagecookie);
		log.info("----");
		return list;

	}

	// 操作员退费报表
	@RequestMapping(value = "/refund_ope", method = RequestMethod.POST)
	public JsonResult<List<JsonRecharge>> refundreport(@RequestBody Recharge recharge,
			@CookieValue(value = "opecodecookie", required = false) String opecodecookie,
			@CookieValue(value = "languagecookie", required = false) String languagecookie)  {
		String issuetime1 = recharge.getIssuetime();
		String issuetime2 = recharge.getRechargetime();
		return rechargereportservice.refundreport(issuetime1, issuetime2, opecodecookie, languagecookie);

	}
	
	// 组织充值报表
	@RequestMapping(value = "/recharge_org", method = RequestMethod.POST)
	public JsonResult<List<JsonRecharge>> rechargereport2(@RequestBody Recharge recharge,
			@CookieValue(value = "opecodecookie", required = false) String opecodecookie,
			@CookieValue(value = "languagecookie", required = false) String languagecookie,
			@CookieValue(value = "opeorgcookie", required = false) String opeorgcookie
			)  {
		String issuetime1 = recharge.getIssuetime();
		String issuetime2 = recharge.getRechargetime();
		return rechargereportservice.rechargereport2(issuetime1, issuetime2, opecodecookie,opeorgcookie, languagecookie);

	}
	
	// 组织退费报表
	@RequestMapping(value = "/refund_org", method = RequestMethod.POST)
	public JsonResult<List<JsonRecharge>> refundreport2(@RequestBody Recharge recharge,
			@CookieValue(value = "opecodecookie", required = false) String opecodecookie,
			@CookieValue(value = "languagecookie", required = false) String languagecookie,
			@CookieValue(value = "opeorgcookie", required = false) String opeorgcookie
			)  {
		String issuetime1 = recharge.getIssuetime();
		String issuetime2 = recharge.getRechargetime();
		return rechargereportservice.rechargereport2(issuetime1, issuetime2, opecodecookie,opeorgcookie, languagecookie);

	}

}
